LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY AddressMUX IS
   PORT(
       CLOCK :  IN STD_LOGIC;
       portChoice : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
	   src_mux0, src_mux1,src_mux2,src_mux3  : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
	   des_mux0, des_mux1,des_mux2,des_mux3 : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
	   src_ready0, src_ready1, src_ready2, src_ready3 : IN STD_LOGIC; 
	   des_ready0, des_ready1, des_ready2, des_ready3 : IN STD_LOGIC;
	   src_ready: OUT STD_LOGIC;
	   des_ready: OUT STD_LOGIC;
	   srcAddress : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
	   desAddress : OUT STD_LOGIC_VECTOR(7 DOWNTO 0)
       );
END AddressMUX;

ARCHITECTURE structural OF AddressMUX IS

BEGIN
PROCESS(src_mux1,des_mux1,src_mux2,des_mux2, portChoice, CLOCK )
BEGIN
IF CLOCK'EVENT AND CLOCK='1'THEN
IF(  portChoice="00" )THEN
srcAddress<=src_mux0;
desAddress<=des_mux0;
src_ready<=src_ready0;
des_ready<=des_ready0;
ELSIF(  portChoice="01" )THEN
srcAddress<=src_mux1;
desAddress<=des_mux1;
src_ready<=src_ready1;
des_ready<=des_ready1;
ELSIF(  portChoice="10" )THEN
srcAddress<=src_mux2;
desAddress<=des_mux2;
src_ready<=src_ready2;
des_ready<=des_ready2;
ELSE
srcAddress<=src_mux3;
desAddress<=des_mux3;
src_ready<=src_ready3;
des_ready<=des_ready3;
END IF;
END IF;
END PROCESS;

END structural;


